package org.openea.eap.module.obpm.service.custsql.impl;

import org.openbpm.base.api.Page;
import org.openbpm.base.api.constant.Direction;
import org.openbpm.base.api.query.QueryFilter;
import org.openbpm.base.api.query.QueryOP;
import org.openbpm.base.db.model.query.DefaultPage;
import org.openbpm.base.db.model.query.DefaultQueryFilter;
import org.openbpm.base.manager.impl.BaseManager;
import org.openea.eap.module.obpm.dao.custsql.FormCustSqlFieldsDao;
import org.openea.eap.module.obpm.service.custsql.FormCustSqlFieldsManager;
import org.openea.eap.module.obpm.model.custsql.FormCustSqlFields;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

















@Service("formCustSqlFieldsManager")
public class FormCustSqlFieldsManagerImpl
  extends BaseManager<String, FormCustSqlFields>
  implements FormCustSqlFieldsManager
{
  @Resource
  FormCustSqlFieldsDao formCustSqlFieldsDao;

  public List<FormCustSqlFields> getListBySqlId(String id) {
    DefaultQueryFilter defaultQueryFilter = new DefaultQueryFilter();
    defaultQueryFilter.addFilter("sql_id_", Arrays.asList(id.split(",")), QueryOP.IN);
    DefaultPage page = new DefaultPage();
    page.setPage(1);
    page.setLimit(2147483647);
    defaultQueryFilter.setPage((Page)page);
    defaultQueryFilter.addFieldSort("sn_", Direction.ASC.getKey());
    return query((QueryFilter)defaultQueryFilter);
  }
}
